import * as echarts from "echarts";
// Generate data
var activityExpense = [255, 170, 150, 150, 100, 120, 610, 502, 401, 110];
var activitiesNumber = [12, 85, 85, 10, 72, 85, 26, 54, 78, 90];

export const getActivitiesDataOption = () => {
  return {
    title: {
      top: 15,
      left: 10,
      textStyle: {
        fontSize: 16,
        color: "#fff",
      },
      text: "年度各基层工会活动信息",
    },
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "shadow",
        label: {
          show: true,
          backgroundColor: "#3259B8",
        },
      },
    },
    legend: {
      data: [{ name: "活动数量" }, { name: "活动费用" }],
      textStyle: {
        color: "rgb(255,255,255,0.5)",
      },
      padding: [25, 0],
    },
    grid: {
      top: "22%",
      left: "3%",
      right: "4%",
      bottom: "5%",
      containLabel: true,
    },
    xAxis: [
      {
        type: "category",
        data: [
          "2014",
          "2015",
          "2016",
          "2017",
          "2018",
          "2019",
          "2020",
          "2021",
          "2022",
          "2023",
        ],
      },
    ],
    yAxis: [
      {
        type: "value",
        name: "活动数量",
        axisLabel: {
          formatter: "{value}",
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: "rgb(70,142,253,0.1)",
          },
        },
      },
      {
        type: "value",
        name: "活动费用(万元)",
        axisLabel: {
          formatter: "{value} 万元",
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: "rgb(70,142,253,0)",
          },
        },
      },
    ],

    series: [
      {
        name: "活动数量",
        type: "bar",
        barWidth: 20,
        itemStyle: {
          barBorderRadius: 10,
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 1, color: "rgb(120,205,118,0.5)" },
            { offset: 0, color: "rgb(120,205,118,1)" },
          ]),
          shadowColor: "rgb(135, 208, 104,1)",
          shadowBlur: 4,
        },
        data: activityExpense,
      },
      {
        name: "活动费用",
        type: "bar",
        yAxisIndex: 1,
        barWidth: 20,
        itemStyle: {
          barBorderRadius: 10,
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 1, color: "rgb(4,195,241,0.5)" },
            { offset: 0, color: "rgb(4,195,241,1)" },
          ]),
          shadowColor: "rgb(4,195,241,1)",
          shadowBlur: 4,
        },
        tooltip: {
          valueFormatter: function (value: string | number) {
            return value + " 万元";
          },
        },
        z: -12,
        data: activitiesNumber,
      },
    ],
  };
};
